package com.skyolder.milkbee.domain;

import io.swagger.annotations.ApiModel;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import javax.persistence.*;
import java.io.Serializable;
import java.time.ZonedDateTime;
import java.util.Objects;

/**
 * Card 帖子
 * title 标题
 * content 内容
 * createdAt 创建时间
 * modifiedAt 修改时间
 * leaguerId 发帖人ID
 * userId 发帖人ID
 * categoryId 所属板块ID
 * recommend 首页推荐
 * recommendTitle 首页推荐标题
 * commentCount 评论数
 * attachment 附件
 * accusation 举报次数
 * look 浏览次数
 * download 附件下载次数
 * light 亮次数
 * essence 精华
 * condition 状态
 */
@ApiModel(description = "Card 帖子 title 标题 content 内容 createdAt 创建时间 modifiedAt 修改时间 leaguerId 发帖人ID userId 发帖人ID categoryId 所属板块ID recommend 首页推荐 recommendTitile 首页推荐标题 commentCount 评论数 attachment 附件 accusation 举报次数 look 浏览次数 download 附件下载次数 light 亮次数 essence 精华")
@Entity
@Table(name = "card")
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class Card implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;

    @Column(name = "title")
    private String title;
    @Column(name = "author")
    private String author;

    @Column(name = "content")
    private String content;

    @Column(name = "created_at")
    private ZonedDateTime createdAt;

    @Column(name = "modified_at")
    private ZonedDateTime modifiedAt;

    @Column(name = "leaguer_id")
    private Long leaguerId;

    @Column(name = "user_id")
    private Long userId;

    @Column(name = "category_id")
    private Long categoryId;

    @Column(name = "recommend")
    private Boolean recommend;

    @Column(name = "recommend_title")
    private String recommendTitle;

    @Column(name = "comment_count")
    private Long commentCount;

    @Column(name = "attachment")
    private String attachment;

    //@org.hibernate.annotations.Type(type="yes_no")
    @Column(name = "accusation")
    private Long accusation;

    @Column(name = "look")
    private Long look;

    @Column(name = "download")
    private Long download;

    @Column(name = "light")
    private Long light;
    //0  1 deny 2 apply 3 agree
    @Column(name = "essence")
    private Integer essence;
    
    @Column(name = "cost")
    private Long cost;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public Card title(String title) {
        this.title = title;
        return this;
    }

    public void setTitle(String title) {
        this.title = title;
    }
    public String getAuthor() {
    	return author;
    }
    
    public Card author(String author) {
    	this.author = author;
    	return this;
    }
    
    public void setAuthor(String author) {
    	this.author = author;
    }

    public String getContent() {
        return content;
    }

    public Card content(String content) {
        this.content = content;
        return this;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public ZonedDateTime getCreatedAt() {
        return createdAt;
    }

    public Card createdAt(ZonedDateTime createdAt) {
        this.createdAt = createdAt;
        return this;
    }

    public void setCreatedAt(ZonedDateTime createdAt) {
        this.createdAt = createdAt;
    }

    public ZonedDateTime getModifiedAt() {
        return modifiedAt;
    }

    public Card modifiedAt(ZonedDateTime modifiedAt) {
        this.modifiedAt = modifiedAt;
        return this;
    }

    public void setModifiedAt(ZonedDateTime modifiedAt) {
        this.modifiedAt = modifiedAt;
    }

    public Long getLeaguerId() {
        return leaguerId;
    }

    public Card leaguerId(Long leaguerId) {
        this.leaguerId = leaguerId;
        return this;
    }

    public void setLeaguerId(Long leaguerId) {
        this.leaguerId = leaguerId;
    }

    public Long getUserId() {
        return userId;
    }

    public Card userId(Long userId) {
        this.userId = userId;
        return this;
    }

    public void setUserId(Long userId) {
        this.userId = userId;
    }

    public Long getCategoryId() {
        return categoryId;
    }

    public Card categoryId(Long categoryId) {
        this.categoryId = categoryId;
        return this;
    }

    public void setCategoryId(Long categoryId) {
        this.categoryId = categoryId;
    }

    public Boolean isRecommend() {
        return recommend;
    }

    public Card recommend(Boolean recommend) {
        this.recommend = recommend;
        return this;
    }

    public void setRecommend(Boolean recommend) {
        this.recommend = recommend;
    }

    public String getRecommendTitle() {
        return recommendTitle;
    }

    public Card recommendTitle(String recommendTitle) {
        this.recommendTitle = recommendTitle;
        return this;
    }

    public void setRecommendTitle(String recommendTitle) {
        this.recommendTitle = recommendTitle;
    }

    public Long getCommentCount() {
        return commentCount;
    }

    public Card commentCount(Long commentCount) {
        this.commentCount = commentCount;
        return this;
    }

    public void setCommentCount(Long commentCount) {
        this.commentCount = commentCount;
    }

    public String getAttachment() {
        return attachment;
    }

    public Card attachment(String attachment) {
        this.attachment = attachment;
        return this;
    }

    public void setAttachment(String attachment) {
        this.attachment = attachment;
    }

    public Long getAccusation() {
        return accusation;
    }

    public Card accusation(Long accusation) {
        this.accusation = accusation;
        return this;
    }

    public void setAccusation(Long accusation) {
        this.accusation = accusation;
    }

    public Long getLook() {
        return look;
    }

    public Card look(Long look) {
        this.look = look;
        return this;
    }

    public void setLook(Long look) {
        this.look = look;
    }

    public Long getDownload() {
        return download;
    }

    public Card download(Long download) {
        this.download = download;
        return this;
    }

    public void setDownload(Long download) {
        this.download = download;
    }

    public Long getLight() {
        return light;
    }

    public Card light(Long light) {
        this.light = light;
        return this;
    }

    public void setLight(Long light) {
        this.light = light;
    }

    public Integer getEssence() {
        return essence;
    }

    public Card essence(Integer essence) {
        this.essence = essence;
        return this;
    }

    public void setEssence(Integer essence) {
    	this.essence = essence;
    }
    

    
    public Long  getCost() {
    	return cost;
    }
    
    public Card essence(Long cost) {
    	this.cost = cost;
    	return this;
    }
    
    public void setCost(Long cost) {
        this.cost = cost;
    } 


    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        Card card = (Card) o;
        if (card.id == null || id == null) {
            return false;
        }
        return Objects.equals(id, card.id);
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(id);
    }

    @Override
    public String toString() {
        return "Card{" +
            "id=" + id +
            ", title='" + title + "'" +
            ", author='" + author + "'" +
            ", content='" + content + "'" +
            ", createdAt='" + createdAt + "'" +
            ", modifiedAt='" + modifiedAt + "'" +
            ", leaguerId='" + leaguerId + "'" +
            ", userId='" + userId + "'" +
            ", categoryId='" + categoryId + "'" +
            ", recommend='" + recommend + "'" +
            ", recommendTitle='" + recommendTitle + "'" +
            ", commentCount='" + commentCount + "'" +
            ", attachment='" + attachment + "'" +
            ", accusation='" + accusation + "'" +
            ", look='" + look + "'" +
            ", download='" + download + "'" +
            ", light='" + light + "'" +
            ", essence='" + essence + "'" +
            '}';
    }
}
